package com.service.system.support;

import java.util.List;

import com.dao.system.IPSWDDao;
import com.pojo.system.PSWD;
import com.pojo.system.PSWDPk;
import com.service.system.IPSWDService;
import com.vo.system.PSWDVo;

public class PSWDService implements IPSWDService {

	private IPSWDDao pswdDao;
	
	public void setPswdDao(IPSWDDao pswdDao) {
		this.pswdDao = pswdDao;
	}

	public PSWD findPSWDById(java.io.Serializable pk) {
		return pswdDao.findPSWDById(pk);
	}

	public List<PSWD> findPSWDByIdAndPwd(PSWDPk pk, String pwd) {
		return pswdDao.findPSWDByIdAndPwd(pk, pwd);
	}

	public boolean validLogin(PSWDVo pswdVo) {
		PSWDPk  pk  = new PSWDPk();
		pk.setCompno(pswdVo.getCompno());
		pk.setUsr(pswdVo.getUsr());
		PSWD pswd = this.findPSWDById(pk);
		if(pswd==null){
			return false;
		}
		return !pswd.getId().getUsr().equals("");
	}

	public List<PSWD> findAllPSWDByCompNo(String compNo) {
		return pswdDao.findAllPSWDByCompNo(compNo);
	}

}
